导航菜单

typescript

问题描述ERROR in src/main.ts:6:21TS7016: Could not find a declaration file for module 'vue-ls'. 'E:/123/node_modules/vue-ls/dist/vue-ls.js' implicitly has an 'any' type. Try `npm i --save-dev @types/vue-ls` if it exists or add a new declaration (.d.ts) file containing `declare module 'vue-ls';`4 | import Vue from 'vue'5 | import App from './App.vue' > 6 | import Storage from 'vue-ls' | ^^^^^^^^7 | import router from './router'8 | import store from './store/'解决办法:方法一:

为了避免这个问题,我只是用标准 require() 替换它

This error occured because of vue-xxxxxx has been generated in JavaScript.

const vue-xxxxxx = require('vue-xxxxxx');// import { vue-xxxxxx } from 'vue-xxxxxx'方法二:

为了避免这个问题,我只是在 tsconfig.json 中修改了这些行

"noImplicitAny": false,"allowJs": true,

现在您可以使用 import 语句,如下所示

import { vue-xxxxxx } from 'vue-xxxxxx'

相关推荐: